<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>一指赢商城</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <link type="text/css" href="http://400tcc.cn/WebApp/Home/View/Public/baofeng/css/public.css" rel="stylesheet" />
    <link href="http://400tcc.cn/WebApp/Home/View/Public/baofeng/css/font_1473832019_2999358.css" rel="stylesheet" type="text/css" />
    <link href="http://400tcc.cn/WebApp/Home/View/Public/baofeng/css/fonts/iconfont.css" rel="stylesheet" type="text/css" />
    <script src="http://400tcc.cn./Public/plugins/css/fonts/iconfont.js"></script>
    <script src="http://400tcc.cn./Public/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src=http://47.52.149.241:3097/socket.io/socket.io.js"></script>
    <script src="http://400tcc.cn/WebApp/Home/View/Public/baofeng/js/layer/layer.js"></script>
    <script src="http://400tcc.cn/WebApp/Home/View/Public/baofeng/js/public.js?v=80"></script>
    <script src="http://400tcc.cn/WebApp/Home/View/Public/baofeng/js/jsAddress.js"></script>
    <link type="text/css" href="http://400tcc.cn/WebApp/Home/View/Public/baofeng/js/layer/need/layer.css" rel="stylesheet" />
    <link type="text/css" href="http://400tcc.cn/WebApp/Home/View/Public/baofeng/css/user.css" rel="stylesheet" />
    <style>
        * {
            padding: 0;
            margin: 0;
            list-style: none;
            border: 0;
        }
        body {
            padding-bottom: 70px;
            color: #333333;
        }
        .payway-wrap {
            border-top: 1px solid #ccc;
            margin-top: 10px;
        }
        .money-wrap, .bank-wrap{
            background-color: #fff;
            font-size: 15px;
        }
        .money-wrap li, .bank-wrap li {
            width: 100%;
            border-bottom: 1px solid #ccc;
            height: 40px;
            line-height: 40px;
            white-space: nowrap;
            padding: 0 10px;
            box-sizing: border-box;
        }
        .money-wrap .key, .bank-wrap .key {
            width: 6em;
        }
        .bank-wrap input, .money-wrap input {
            height: 40px;
            line-height: 40px\9;
            font-size: 15px;
            padding: 0 10px;
            width: 100%;
            box-sizing: border-box;
            background-color: transparent;
            color: #333;
        }
        .table {
            display: table !important;
        }
        .table-cell {
            display: table-cell !important;
        }
        .fee-tip {
            color: #999;
            border-bottom: 1px solid #ccc;
            padding: 10px;
            white-space: nowrap;
        }

        .payway-title {
            font-size: 15px;
            color: #333;
            padding: 10px;
            background-color: #FFF;
            display: -webkit-box;
            -webkit-box-orient: horizontal;
            -webkit-box-align: center;
        }
        .payway-content {
            border-top: 1px solid #ccc;
            border-bottom: 1px solid #ccc;
            line-height: 30px;
            background-color: #FFF;
        }
        .payway-content ul {
            padding-left: 10px;
        }
        .payway-content li {
            width: 100%;
            border-bottom: 1px solid #ccc;
            height: 30px;
            line-height: 30px;
            padding: 5px 20px 5px 0;
            box-sizing: border-box;
        }
        .payway-content li:last-child {
            border-bottom: 0;
        }
        .payway-content li > div {
            font-size: 15px;
            vertical-align: middle;
        }
        .payway-content .symbol-wrap {
            width: 40px;
        }
        i.icon {
            display: inline-block;
            width: 30px;
            height: 30px;
            background: url(http://400tcc.cn/WebApp/Home/View/Public/baofeng/img/icon.png) no-repeat;
            background-size: 1400%;
        }
        i.icon.icon-yl {
            background-size: 1600%;
            vertical-align: top;
            background-position: -266px -186px;
        }
        .payway-content .choose-wrap {
            width: 30px;
            text-align: right;
        }
        .payway-content .choose-wrap .choose {
            display: inline-block;
            width: 15px;
            height: 15px;
            border-radius: 100%;
            vertical-align: middle;
            font-style: normal;
            text-align: center;
            line-height: 15px;
        }
        .payway-content .choose-wrap .choose-full {
            border: 2px solid #4fa9ee;
            background-color: #4fa9ee;
            color: #fff;
            font-size: 13px;
        }
        .mobile-wrap {
            background-color: #f2f2f2;
        }
        #btn-validcode {
            text-align: right;
            color: #ccc;
            width: 5.5em;
        }
        #btn-validcode.active {
            color: #2093ec;
        }
        #errorMsg {
            padding: 10px;
            line-height: 30px;
            height: auto;
            color: #d82f2f;
            margin: 0px;
        }
        .yebz_but {
            height: 36px;
            line-height: 36px;
            border: 0;
            background-color: #2093ec;
            font-size: 13px;
            color: #FFF;
            margin: 10px 10px 15px;
            border-radius: 4px;
            -webkit-border-radius: 4px;
            -moz-border-radius: 4px;
            -ms-border-radius: 4px;
            -o-border-radius: 4px;
            text-align: center;
            display: block;
        }
        .yebz_but {
            margin-top: 5px;
        }
        .yebz_but.disable {
            background-color: #ccc;
            cursor: not-allowed;
        }
        .yebz_but.hide {
            display:none;
        }
        .icon {
            width: 1em;
            height: 1.8em;
            fill: currentColor;
            overflow: hidden;
        }
    </style>
    <script>
        $(function () {
            areaSelect.createSelect("province", "city");
            $("#province").on("change", function () {
                $("#province_txt").val($(this).find("option:selected").text());
            });
            $("#city").on("change", function () {
                $("#city_txt").val($(this).find("option:selected").text());
            });

            $("#province").children("option").each(function(){
                if ($(this).text() == $("#province_txt").val()) {
                    $(this).attr("selected", true);
                    $("#province").change();
                    $("#city").children("option").each(function(){
                        if ($(this).text() == $("#city_txt").val()) {
                            $(this).attr("selected", true);
                        }
                    });
                }
            });
        })
    </script>
</head>

<body>
<div class="loader">
    <div class="act">
        <div class="spinner">
            <div class="double-bounce1"></div>
            <div class="double-bounce2"></div>
        </div>
    </div>
    <div class="bg"></div>
</div>
<form id="myform">
    <input type="hidden" name="province" id="province_txt">
    <input type="hidden" name="city" id="city_txt">
    <input type="hidden" name="source" id="source" value="<?php echo ($source); ?>">
    <div class="header uk-block-default" style="border-bottom:1px solid #ccc;">
        <div class="user">
            <div class="headpor" id="info-btn-b">
                <?php if(empty($user["photo_url"])): ?><img src="http://400tcc.cn/Public/images/null_photo.jpg">
                    <?php else: ?>
                    <img src="<?php echo ($user["photo_url"]); ?>"><?php endif; ?>
            </div>
            <div class="attrs">
                <h4 style="color:#333;font-size:16px;font-weight:700;"><?php echo ((isset($user["nick_name"]) && ($user["nick_name"] !== ""))?($user["nick_name"]):''); ?></h4>
                <?php if($source == 1): ?><div style="font-size:15px;color:#333;">可提现金额：<span style="color:#e63234;"><?php echo (sprintf('%.2f',$user['balance'])); ?></span></div>
                    <?php else: ?>
                    <div style="font-size:15px;color:#333;">可提经纪人收入：<span style="color:#e63234;"><?php echo (sprintf('%.2f',$user['balance'])); ?></span></div><?php endif; ?>

            </div>
        </div>
    </div>
    <div class="payway-wrap">
        <ul class="money-wrap"><li class="table"><span class="table-cell key" style="color:#333;">提现金额</span><input type="number" name="money" id="money" class="money table-cell" maxlength="12" placeholder="请输入提现金额"></li></ul>
        <div class="fee-tip" style="font-size:11px;">最低提现金额100元，手续费2元/笔</div>
        <div class="txway-wrap">
            <div class="payway-title">提现方式</div>
            <div class="payway-content">
                <ul>
                    <li class="table ylpay-box">
                        <div class="table-cell symbol-wrap"><i style="font-size:16px;"><svg class="icon" style="width:100%;" aria-hidden="false"><use xlink:href="#icon-yinlianzhifu"></use></svg></i></div>
                        <div class="table-cell" style="color:#333;">银联出金</div>
                        <div class="table-cell choose-wrap"><i class="choose choose-full">✓</i></div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="txunion-wrap">
        <ul class="bank-wrap select-wrap">
            <li class="table">
                <span class="table-cell key">银行</span>
                <span class="yinhang" id="bank_img" style="display: none;"><img id="bank_img_src" src=""></span>
                <select class="form-control" id="bank_name" name="bank_name" style="width:100%;font-size:15px;padding-left:6px;height:40px;">
                    <option value="" selected>请选择开卡银行</option>
                    <option value="中国银行" <?php echo ($userBank['bank_name']=="中国银行"?"selected":""); ?>>中国银行</option>
                    <option value="工商银行" <?php echo ($userBank['bank_name']=="工商银行"?"selected":""); ?>>工商银行</option>
                    <option value="农业银行" <?php echo ($userBank['bank_name']=="农业银行"?"selected":""); ?>>农业银行</option>
                    <option value="招商银行" <?php echo ($userBank['bank_name']=="招商银行"?"selected":""); ?>>招商银行</option>
                    <option value="建设银行" <?php echo ($userBank['bank_name']=="建设银行"?"selected":""); ?>>建设银行</option>
                    <option value="邮政储蓄" <?php echo ($userBank['bank_name']=="邮政储蓄"?"selected":""); ?>>邮政储蓄</option>
                    <option value="华夏银行" <?php echo ($userBank['bank_name']=="华夏银行"?"selected":""); ?>>华夏银行</option>
                    <option value="光大银行" <?php echo ($userBank['bank_name']=="光大银行"?"selected":""); ?>>光大银行</option>
                    <option value="中信银行" <?php echo ($userBank['bank_name']=="中信银行"?"selected":""); ?>>中信银行</option>
                    <option value="民生银行" <?php echo ($userBank['bank_name']=="民生银行"?"selected":""); ?>>民生银行</option>
                    <option value="交通银行" <?php echo ($userBank['bank_name']=="交通银行"?"selected":""); ?>>交通银行</option>
                    <option value="浦发银行" <?php echo ($userBank['bank_name']=="浦发银行"?"selected":""); ?>>浦发银行</option>
                    <option value="广发银行" <?php echo ($userBank['bank_name']=="广发银行"?"selected":""); ?>>广发银行</option>
                </select>
            </li>
        </ul>
        <ul class="bank-wrap select-wrap ">
            <li class="table">
                <span class="table-cell key">省份</span>
                <select class="form-control" id="province" style="width:100%;font-size:15px;padding-left:6px;height:40px;"></select>
            </li>
        </ul>
        <ul class="bank-wrap select-wrap ">
            <li class="table">
                <span class="table-cell key">城市</span>
                <select class="form-control" id="city" style="width:100%;font-size:15px;padding-left:6px;height:40px;"></select>
            </li>
        </ul>
        <ul class="bank-wrap ">
            <li class="table">
                <span class="table-cell key">卡号</span><input type="number" id="bank_no" name="bank_no" value="<?php echo ($userBank["bank_no"]); ?>" class="table-cell input-text" maxlength="19" placeholder="请输入银行卡卡号">
            </li>
            <li class="table">
                <span class="table-cell key">持卡人</span><input type="text" id="cardholder" name="cardholder" value="<?php echo ($userBank["cardholder"]); ?>"  class="table-cell input-text" placeholder="请输入持卡人姓名" maxlength="20">
            </li>
            <li class="table">
                <span class="table-cell key">身份证</span><input type="text" id="identity" name="identity" value="<?php echo ($userBank["identity"]); ?>"  class="table-cell input-text" placeholder="请输入持卡人身份证" maxlength="20">
            </li>
        </ul>
        <ul class="bank-wrap">
            <li class="table mobile-wrap"><span class="table-cell key">已验证手机</span><span id="mobile"><?php echo ($user["mobile_phone"]); ?></span></li>
            <li class="table">
                <span class="table-cell key">验证码</span>
                <input type="text" class="table-cell input-text" id="smsCode" name="smsCode" maxlength="6" placeholder="输入短信验证码">
                <a onclick="SendMsg('f')" id="btn-validcode" time="120" class="table-cell active">获取验证码</a>
            </li>
            <li class="table">
                <span class="table-cell key">交易密码</span>
                <input type="password" class="table-cell input-text" id="password" name="password" placeholder="输入交易密码">
            </li>
        </ul>
    </div>
    <p id="errorMsg" style="color: rgb(255, 0, 0);"></p>
    <a onclick="subForm()" id="yebz_but" class="yebz_but">确认提现</a>
	<a style="display:block;text-align:center;margin-top:35px;color: #157afb;text-decoration: underline;padding-bottom:30px;" href="http://400tcc.cn/user/suggest" class="line">投诉&建议</a>
</form>
<script>
    var isSub = true;
    var isSendSms = true;
    var timer1 = null;
    function SendMsg(type) {
        $("#errorMsg").html("");
        if (isSendSms == true) {
            isSendSms = false;
            loadshow();
            $.post("http://400tcc.cn/user/sendSMS", { type: type, mobile_phone:1 }, function(result) {
                loadhide();
                if(result.success == 0) {
                    $("#errorMsg").html("验证码已发送，请注意查收！");
                    SetRemainTime();
                } else {
                    isSendSms = true;
                    $("#errorMsg").html(result.msg);
                }
            });
        }
    }

    function SetRemainTime() {
        isSendSms = false;
        var time = $("#btn-validcode").attr("time");
        time = time - 1;
        $("#btn-validcode").attr("time", time);
        $("#btn-validcode").html(time + "秒");
        if (time == 0) {
            isSendSms = true;
            $("#btn-validcode").html("获取验证码");
            $("#btn-validcode").attr("time", 120);
            clearTimeout(timer1);
        } else {
            timer1 = setTimeout(function () { SetRemainTime() }, 1000);
        }
    }

    function subForm() {
        var money = $("#money").val();
        var bank_name = $("#bank_name").val();
        var province_txt = $("#province_txt").val();
        var city_txt = $("#city_txt").val();
		var source = $("#source").val();
        var bank_no = $("#bank_no").val();
        var cardholder = $("#cardholder").val();
        var identity = $("#identity").val();
        var smsCode = $("#smsCode").val();
        var password = $("#password").val();
        if (money == "") {
            $("#errorMsg").html("提取金额不能为空");
            return;
        } else if (money < <?php echo ($sys['lowest_money']); ?>) {
            $("#errorMsg").html("最低提现金额为<?php echo ($sys['lowest_money']); ?>元");
            return;
        } else if(money > <?php echo ($user['balance']); ?>){
            $("#errorMsg").html("您目前的最大提取额度为<?php echo ($user['balance']); ?>元");
            return;
        } else if (money > <?php echo ($sys['highest_money']); ?>) {
            $("#errorMsg").html("最大提现金额为<?php echo ($sys['highest_money']); ?>元");
            return;
        }
        if (bank_name == "") {
            $("#errorMsg").html("请选择开卡银行");
            return;
        }
        if (province_txt == "") {
            $("#errorMsg").html("请选择开卡省份");
            return;
        }
        if (city_txt == "") {
            $("#errorMsg").html("请选择开卡城市");
            return;
        }
        if (bank_no == "") {
            $("#errorMsg").html("请输入银行卡卡号");
            return;
        } else if (bank_no.length < 16 || bank_no.length > 19) {
            $("#errorMsg").html("银行卡号长度必须在16到19之间");
            return;
        }
        var num = /^\d*$/; //全数字
        if(!num.exec(bank_no)) {
            $("#errorMsg").html("银行卡号必须全为数字");
            return false;
        }
        if (cardholder == "") {
            $("#errorMsg").html("请输入持卡人姓名");
            return;
        }
        if (identity == "") {
            $("#errorMsg").html("请输入持卡人身份证号");
            return;
        }
        if (smsCode == "") {
            $("#errorMsg").html("输入短信验证码");
            return;
        }
        if (password == "") {
            $("#errorMsg").html("输入交易密码");
            return;
        }

        $("#errorMsg").html("");
        if (isSub == true) {
            isSub = false;
            loadshow();
            $("#yebz_but").addClass("disable");
            // var bank_address = province_txt + city_txt;
            $.post("http://400tcc.cn/user/userDraw", { source:source, money:money, bank_name:bank_name, bank_province:province_txt, bank_city:city_txt, bank_no:bank_no, cardholder:cardholder, identity:identity, smsCode:smsCode, password:password }, function(result) {
                $("#yebz_but").removeClass("disable");
                $("#yebz_but").addClass("hide");
                loadhide();
                isSub = true;
                if(result.success == 0) {
                    $("#errorMsg").html(result.msg);
                } else {
                    $("#errorMsg").html(result.msg);
                }
            });
        }
    }
</script>
</body>
</html>